<?php
/**
 * @Notes:【】
 * @Date: 2022-06-11 1:36
 */

namespace App\Controller\Admin\Settings\Task;

use App\Controller\Admin\BaseController;
use App\Middleware\CheckAdminMiddleware;
use App\Service\Settings\TaskRefreshService;
use App\Service\Settings\TaskTopService;
use App\Service\Task\TaskHelpService;
use App\Service\Task\TaskService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;

/**
 * @ApiController(prefix="admin/settings/task/top")
 * @Middleware(CheckAdminMiddleware::class)
 */
class TopController extends BaseController
{
    /**
     * @Notes:【】
     * @Date: 2022-06-11 1:37
     * @var TaskTopService
     * @Inject
     */
    
    protected $taskTopService;

    /**
     * @Notes:【】
     * @Date: 2022-06-11 1:41
     * @PostApi(path="lists")
     */
    public function lists()
    {
        $params = $this->getParams();
        $data = $this->taskTopService->lists($params);
        _SUCCESS($data);
    }


    /**
     * @Notes:【】
     * @Date: 2022-06-08 23:22
     * @PostApi(path="add")
     * @FormData(key="num")
     * @FormData(key="price")
     */
    public function add()
    {
        $params = $this->getData(false);
        $data = $this->taskTopService->add($params);
        _SUCCESS($data);
    }


    /**
     * @Notes:【】
     * @Date: 2022-06-08 23:22
     * @PostApi(path="edit")
     * @FormData(key="id")
     * @FormData(key="num")
     * @FormData(key="price")
     */
    public function edit()
    {
        $params = $this->getData(false);
        $data = $this->taskTopService->edit($params);
        _SUCCESS($data);
    }

    /**
     * @Notes:【】
     * @Date: 2022-06-08 23:22
     * @PostApi(path="del")
     * @FormData(key="id")
     */
    public function del()
    {
        $params = $this->getData(false);
        $data = $this->taskTopService->del($params->get('id'));
        _SUCCESS();
    }


}